package com.ck.springboot.mybatis.controller;

import com.ck.springboot.mybatis.entity.User;
import com.ck.springboot.mybatis.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
public class UserController {

    @Autowired
    private UserService userService;

    @GetMapping("get")
    public User getUser(int id) {
        User user =  userService.getById(id);
        return user;
    }

    @GetMapping("getxml")
    public User selectByPrimaryKey(int id) {
        User user = userService.selectByPrimaryKey(id);
        return user;
    }

}
